package com.guohang.mic_01;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.Messenger;
import android.view.Menu;
import android.view.View;


public class ContextMIC extends Activity {
	
	  private Handler mHandler = new Handler() {
		    public void handleMessage(Message message) {
		      Bundle data = message.getData();
		      if (message.arg1 == RESULT_OK && data != null) {

		      }
		    }
		  };
  
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_context_mic);
        
        //Start Context Service
        Intent mServiceIntent = new Intent(this, ContextService.class);
        
        Messenger messenger = new Messenger(mHandler);
        mServiceIntent.putExtra("MESSENGER", messenger);
        
        //start an empty intent
        this.startService(mServiceIntent);

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_context_mic, menu);
        return true;
    }
    
    
    public void onStop(View view){
      this.stopService(new Intent(this, ContextService.class));	
    }

   
}
